package com.taplinker.client.im.rpc;

import com.taplinker.client.im.domain.ImDataCenter;
import com.taplinker.client.im.protocol.TapLinkerConversation;
import com.taplinker.client.im.util.IMLogUtil;
import com.taplinker.core.rpc.Result;

public class Cmd007 extends   SimpleSocketCommand<String> {
	protected TapLinkerConversation conversation;
	public Cmd007(TapLinkerConversation conversation) {
		this.conversation = conversation;
	}
	
	@Override
	public void yes(Result result) {
		IMLogUtil.log("007",conversation.getId());

		if(conversation.getUnreadMessages()>0) {
			ImDataCenter.getInstance().setPriNum(ImDataCenter.getInstance().getPriNum()-1);
		}
		conversation.setUnreadMessages(0);
		
		ImDataCenter.getInstance().noticeListener(ImDataCenter.MENU_REFRESH);
		ImDataCenter.getInstance().noticeListener(ImDataCenter.QUEUE_REFRESH);
	}

	@Override
	protected String getBody() {
		return conversation.getId();
	}
	
	@Override
	protected String getCommand() {
		return "007";
	}
}
